import org.omg.CORBA.UserException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:DELL
 * Date:2024-10-24
 * Time:23:54
 */
class UserNameException extends Exception{
    public UserNameException(String message){
        super(message);
    }
}
class UserPasswordException extends Exception{
    public UserPasswordException(String message) {
        super(message);
    }
}
public class Login {
    private static String userName="admin";
    private String password="123456";
    public static void loginInfo(String userName, String password)
            throws UserNameException,UserPasswordException {
        if(!userName.equals((userName))){
            throw new UserNameException("用户名错误！");
        }
        if(!password.equals(password)){
            throw new UserPasswordException("密码错误！");
        }
        System.out.println("登陆成功");
    }

    public static void main(String[] args) {
        try {
            loginInfo("admin","123456");

        } catch (UserNameException e) {
            throw new RuntimeException(e);
        } catch (UserPasswordException e) {
            throw new RuntimeException(e);
        }
    }
}
